﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CitizenJournalismNetworkServer.Enumerations;
using System.ComponentModel.DataAnnotations;
using CitizenJournalismNetworkServer.Attributes;

namespace CitizenJournalismNetworkServer.Models
{
    public class Entry
    {
        [SerializationIgnore]
        [DatabaseGenerated(System.ComponentModel.DataAnnotations.DatabaseGenerationOption.Identity)]
        public int Id { get; set; }

        [SerializationDescend(false)]
        [SerializationName("authors")]
        public virtual ICollection<Person> Authors { get; set; }

        [SerializationDescend(false)]
        [SerializationName("categories")]
        public virtual ICollection<Category> Categories { get; set; }

        //+++ Temporarily disabled until I figure out how to set up the composite relationship.
        //[SerializationComposition]
        // public Content Content { get; set; }

        [SerializationDescend(false)]
        [SerializationName("contributors")]
        public virtual ICollection<Person> Contributors { get; set; }

        [SerializationName("id")]
        public string AtomId { get; set; }

        [SerializationName("links")]
        [SerializationDescend(false)]
        public virtual ICollection<Link> Links { get; set; }

        [SerializationName("published")]
        public DateTime DatePublished { get; set; }

        [SerializationName("rights")]
        public string Rights { get; set; }

        [SerializationName("source")]
        [SerializationExclude("Source")]
        public Entry Source { get; set; }

        [Required]
        [SerializationName("summary")]
        public string Summary { get; set; }

        [Required]
        [SerializationName("title")]
        public string Title { get; set; }

        [SerializationName("updated")]
        public DateTime DateUpdated { get; set; }

        [Required]
        [SerializationName("draft")]
        [SerializationBooleanRepresentation(SerializationBooleanRepresentationAttribute.BooleanRepresentation.YesNo)]
        public bool IsDraft { get; set; }

    }
}